<template>
	<m-page :pageData="pageData" :mPadding="mPadding">
		<scroll-view slot="content" class="article-content" :scroll-y="true" >
			<jyf-parser v-if="isMobile" :html="content || '暂无内容'" ref="article "></jyf-parser>
			<view v-else class="" v-html="content  || '暂无内容'"></view>
		</scroll-view>>
	</m-page>
</template>

<script>
	import jyfParser from '@/components/jyf-parser/jyf-parser'
	export default {
		data() {
			return {
				pageData:{
					showBrand:false,
					showTips:true,
					title:'',
					titleClass:'disn',
					diy:true,
					m:true,
				},
				options:{},
				content:'',
				mPadding:'40px 5px 40px 40px',
				
			}
		},
		onLoad(options) {
			let _this = this;
			setTimeout(()=>{
				_this.mPadding = _this.isMobile?'20px':'40px 5px 40px 15px'
			},0)
			this.options = options
			this.pageData.title = options.title || '详情'
			if(isNaN(this.options.id)){
				this.getByDictCode()
			}else{
				//获取文章详情
				this.notifyDetail()
			}
			// if(uni.getStorageSync('msgContent')){
			// 	this.content = uni.getStorageSync('msgContent')
			// 	this.msgUpdateStatus()
			// }else{
			// 	this.utils.goPath('/pages/index/index')
			// }
		},
		methods: {
			// msgUpdateStatus(){
			// 	let par = {
			// 		id:this.options.id *1
			// 	}
			// 	this.$api.msgUpdateStatus(par).then(res => {
			// 		if(res.code == 200){
			// 			this.getMsg()
			// 		}
			// 	})
			// },
			getByDictCode(){
				this.$api.getByDictCode({dict_code:this.options.id}).then(res => {
					if(res.code == 200){
						this.content = res.data.dict_value
					}
				})
			},
			// getUserAgree(){
			// 	this.$api.user_agreement().then(res => {
			// 		if(res.code == 200){
			// 			this.content = res.data
			// 		}
			// 	})
			// },
			notifyDetail(){
				this.$api.notifyDetail({id:this.options.id*1}).then(res => {
					if(res.code == 200){
						if(res.data.status == 1){
							this.pageData.title = res.data.title
							this.content = res.data.content
						}
						
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.article-content{
		height: calc(100vh - 68px - 160px);
		@extend .show-scrollbar;
	}
	@media screen and (min-width: 0px) and (max-width:1024px){
		.article-content{
			height:100%;
			word-break:break-all;
			*{
				max-width: 100%;
			}
			/deep/img{
				// width: 100%;
				height: auto;
			}
			/deep/.myclass{
				font-size: 12pt;
				line-height: 1.5;
			}
		}
	}
</style>
